package test.zhyh.kit;

import java.util.Date;

import zhyh.kit.excel.ExcelIOBaseModel;
import zhyh.kit.excel.annotations.ExcelField;
import zhyh.kit.excel.annotations.ExcelTitle;

@ExcelTitle(cellStartAt = 0, rowStartAt = 0, title = { "编号", "姓名", "注册时间", "身高", "年龄", "生日", "性别" }, exportTitle = {
		"编号", "姓名", "注册时间", "身高", "年龄", "生日", "性别" })
public class Person extends ExcelIOBaseModel
{
	//需要Excel导出的属性需要添加@ExcelField注解并提供getter

	@ExcelField(cellAt = 0, isNotNull = true)
	private String	id;
	@ExcelField(cellAt = 1)
	private String	name;
	@ExcelField(cellAt = 2, dateFormat = "yyyy-MM-dd HH:mm:ss")
	private Date	registedTime;
	@ExcelField(cellAt = 3, sectionOfDouble = { 100.0, 300.0 })
	private Double	height;
	@ExcelField(cellAt = 4, sectionOfInteger = { 1, 120 })
	private Integer	age;
	@ExcelField(cellAt = 5, dateFormat = "yyyy-MM-dd")
	private Date	birthday;
	@ExcelField(cellAt = 6, format = true)
	private int		gender;

	public int genderDeCode(String gender) {
		if ("男".equals(gender))
			return 1;
		else
			return 0;
	}

	public String genderEnCode() {
		if (this.gender == 1)
			return "男";
		else
			return "女";
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getRegistedTime() {
		return registedTime;
	}

	public void setRegistedTime(Date registedTime) {
		this.registedTime = registedTime;
	}

	public Double getHeight() {
		return height;
	}

	public void setHeight(Double height) {
		this.height = height;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Person() {
		super();
	}

	@Override
	public String toString() {
		return "{\"id\" : \"" + id + "\" , \"name\" : \"" + name + "\" , \"registedTime\" : \"" + registedTime
				+ "\" , \"height\" : \"" + height + "\" , \"age\" : \"" + age + "\" , \"birthday\" : \"" + birthday
				+ "\" , \"gender\" : \"" + gender + "\" , \"errorMessages\" : \"" + errorMessages + "\"}";
	}

	public Person(String id, String name, Date registedTime, Date birthday, Double height, Integer age, int gender) {
		super();
		this.id = id;
		this.name = name;
		this.registedTime = registedTime;
		this.height = height;
		this.age = age;
		this.birthday = birthday;
		this.gender = gender;
	}

}
